//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------


#ifdef ENGINE_META_DATA

// deserialize from binary
#	define __SYS_META_DESERIALIZE( _type, _name, _dstName, _initValue )		FILE_RW_CHECK( MetaDataUtils::Load( file, this->_name ) );

// copy from meta object to engine object
#	define __SYS_COPY_META_FIELDS( _type, _name, _dstName, _initValue )		MetaDataUtils::Copy( obj->_dstName, this->_name, ess );

#endif


#ifdef EXTERNAL_META_DATA

// init meta data fields
#	define __SYS_INIT_META_OBJECT( _type, _name, _dstName, _initValue )		iter->AddField( this->_name, StringUtils::ToMetaFieldName( #_name ).cstr() );

// set default values
#	define __SYS_INIT_FIELDS( _type, _name, _dstName, _initValue )			_name = _type(_initValue);

// init meta data for fields
#	define __SYS_INIT_META_DEPENDANCY( _type, _name, _dstName, _initValue )	MetaDataUtils::InitMetaData( this->_name );

#endif
	

#if defined(ENGINE_META_DATA) or \
	defined(EXTERNAL_META_DATA)

// declare fields
#	define __SYS_META_DECL_FIELDS( _type, _name, _dstName, _initValue )		_type	_name;

// serialize to binary
#	define __SYS_META_SERIALIZE( _type, _name, _dstName, _initValue )		FILE_RW_CHECK( MetaDataUtils::Save( file, this->_name ) );

// for all fields
#	define __SYS_META_FOR_ALL_FIELDS( _type, _name, _dstName, _initValue )	Func( TypeId< _type >(), (void *) &_name, param );

#endif


namespace MetaData
{
}

/*
	Example:

	#define ENGINE_META_DATA
	#include "MetaDataCommon.h"
	#include "MetaDatautils.h"
	
	// object:
		#define META_OBJECT			<prefix> <meta object name>
		#define META_OBJECT_NAME	<meta object name>
		#define META_NAME			<prefix> <meta object name>
		#define META_BASECLASS		<engine object name>

		#define META_FIELDS( _decl ) \
			_decl( <type>, <meta object field name>, <engine object field name>, <init value> )

		#include "MetaDataObject.h"
*/